<meta charset="utf-8"/>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>

<script type="text/javascript">
$(document).ready(function(){

  $('img2').click(function(){
    $this = $(this);
    if ($this.data('clicked') == 1)
    {
      return;
    }
    $this.data('clicked', 1);
    $clone = $(this).clone().css({'position':'absolute'});
    $(this).after($clone);
    var $cart = $('#cart');
    $clone.css('opacity', '0.6').animate({left:$cart.offset().left - $clone.outerWidth()/2, top:$cart.offset().top - 50 - $clone.offset().top}, 1000, function(){
      $(this).css('opacity', '1').animate({'top':$cart.offset().top + 30}, 1000, function(){
        $(this).fadeOut('fast', function(){
          $(this).remove();
        });
        $this.data('clicked', 0);
      });
    });
  });

  var s = ($('#cart').offset().left - $('img').offset().left + $('#cart').outerWidth()/2 - $('img').outerWidth()/2)/40;
  var x = $('#cart').offset().top - $('img').offset().top - $('#cart').outerHeight(); //位移
  var a = (2*x)/(40*40); //加速度
  var timeid = 0;
  var i = 1;
  var pao = function(obj)
  {
    if (i>40)
    {
      clearInterval(timeid);
        return false;
   }

   obj.css({
    left:(s*i),
    top:((1/2)*a*i*i)
   });

   i++;
  }

  $('img').click(function(){
    $this = $(this);
    $clone = $(this).clone().css({'position':'absolute'});
    $this.after($clone);
    timeid = setInterval(function(){
      pao($clone);
    }, 25);
  });


});
</script>

<img src="http://img02.taobaocdn.com/bao/uploaded/i2/133006562/T2Y6yaXb0cXXXXXXXX_!!133006562.jpg_30x30.jpg" width="30" height="30" style="border:3px solid red; cursor:pointer; margin-top:10px; margin-left:10px;" />


<div id="cart" style="width:200px; height:30px; background:red; color:#fff; text-align:center; line-height:30px; border:3px solid #ccc; z-index:99999; position:fixed; right:0; bottom:0;">购物车</div>

<p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p>